﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Diagnostics;

namespace Viet_Calculator
{
	/// <summary>
	/// Summary description for GiaiPhuongTrinhBac3PhienBanMoi.
	/// </summary>
	public class GiaiPhuongTrinhBac3PhienBanMoi : System.Windows.Forms.Form
	{
		private System.Windows.Forms.GroupBox groupBox3;
		private System.Windows.Forms.TextBox txtX3;
		private System.Windows.Forms.TextBox txtX2;
		private System.Windows.Forms.TextBox txtX1;
		private System.Windows.Forms.Label label25;
		private System.Windows.Forms.Label label26;
		private System.Windows.Forms.Label label21;
		private System.Windows.Forms.Label label22;
		private System.Windows.Forms.Label label23;
		private System.Windows.Forms.Label label24;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.Label label15;
		private System.Windows.Forms.Label label14;
		private System.Windows.Forms.Label label13;
		private System.Windows.Forms.Label label11;
		private System.Windows.Forms.TextBox txtB;
		private System.Windows.Forms.TextBox txtD;
		private System.Windows.Forms.TextBox txtC;
		private System.Windows.Forms.Label label19;
		private System.Windows.Forms.Label label18;
		private System.Windows.Forms.Label label8;
		private System.Windows.Forms.Label label16;
		private System.Windows.Forms.Label label17;
		private System.Windows.Forms.GroupBox groupBox4;
		private System.Windows.Forms.Button btnGiai;
		private System.Windows.Forms.Label label10;
		private System.Windows.Forms.Label label9;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TextBox txtA;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.LinkLabel linkLabel1;
		private System.Windows.Forms.Label label20;
		private System.Windows.Forms.Label label12;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public GiaiPhuongTrinhBac3PhienBanMoi()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(GiaiPhuongTrinhBac3PhienBanMoi));
			this.groupBox3 = new System.Windows.Forms.GroupBox();
			this.txtX3 = new System.Windows.Forms.TextBox();
			this.txtX2 = new System.Windows.Forms.TextBox();
			this.txtX1 = new System.Windows.Forms.TextBox();
			this.label25 = new System.Windows.Forms.Label();
			this.label26 = new System.Windows.Forms.Label();
			this.label21 = new System.Windows.Forms.Label();
			this.label22 = new System.Windows.Forms.Label();
			this.label23 = new System.Windows.Forms.Label();
			this.label24 = new System.Windows.Forms.Label();
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			this.label15 = new System.Windows.Forms.Label();
			this.label14 = new System.Windows.Forms.Label();
			this.label13 = new System.Windows.Forms.Label();
			this.label11 = new System.Windows.Forms.Label();
			this.txtB = new System.Windows.Forms.TextBox();
			this.txtD = new System.Windows.Forms.TextBox();
			this.txtC = new System.Windows.Forms.TextBox();
			this.label19 = new System.Windows.Forms.Label();
			this.label18 = new System.Windows.Forms.Label();
			this.label8 = new System.Windows.Forms.Label();
			this.label16 = new System.Windows.Forms.Label();
			this.label17 = new System.Windows.Forms.Label();
			this.groupBox4 = new System.Windows.Forms.GroupBox();
			this.btnGiai = new System.Windows.Forms.Button();
			this.label10 = new System.Windows.Forms.Label();
			this.label9 = new System.Windows.Forms.Label();
			this.label7 = new System.Windows.Forms.Label();
			this.label6 = new System.Windows.Forms.Label();
			this.label5 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.txtA = new System.Windows.Forms.TextBox();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.linkLabel1 = new System.Windows.Forms.LinkLabel();
			this.label20 = new System.Windows.Forms.Label();
			this.label12 = new System.Windows.Forms.Label();
			this.groupBox3.SuspendLayout();
			this.groupBox2.SuspendLayout();
			this.groupBox4.SuspendLayout();
			this.groupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// groupBox3
			// 
			this.groupBox3.Controls.Add(this.txtX3);
			this.groupBox3.Controls.Add(this.txtX2);
			this.groupBox3.Controls.Add(this.txtX1);
			this.groupBox3.Controls.Add(this.label25);
			this.groupBox3.Controls.Add(this.label26);
			this.groupBox3.Controls.Add(this.label21);
			this.groupBox3.Controls.Add(this.label22);
			this.groupBox3.Controls.Add(this.label23);
			this.groupBox3.Controls.Add(this.label24);
			this.groupBox3.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.groupBox3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.groupBox3.Location = new System.Drawing.Point(8, 232);
			this.groupBox3.Name = "groupBox3";
			this.groupBox3.Size = new System.Drawing.Size(736, 72);
			this.groupBox3.TabIndex = 15;
			this.groupBox3.TabStop = false;
			this.groupBox3.Text = "Kết quả";
			// 
			// txtX3
			// 
			this.txtX3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.txtX3.Location = new System.Drawing.Point(536, 32);
			this.txtX3.Name = "txtX3";
			this.txtX3.ReadOnly = true;
			this.txtX3.Size = new System.Drawing.Size(192, 22);
			this.txtX3.TabIndex = 21;
			this.txtX3.Text = "";
			// 
			// txtX2
			// 
			this.txtX2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.txtX2.Location = new System.Drawing.Point(264, 32);
			this.txtX2.Name = "txtX2";
			this.txtX2.ReadOnly = true;
			this.txtX2.Size = new System.Drawing.Size(192, 22);
			this.txtX2.TabIndex = 20;
			this.txtX2.Text = "";
			// 
			// txtX1
			// 
			this.txtX1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.txtX1.Location = new System.Drawing.Point(64, 32);
			this.txtX1.Name = "txtX1";
			this.txtX1.ReadOnly = true;
			this.txtX1.Size = new System.Drawing.Size(120, 22);
			this.txtX1.TabIndex = 19;
			this.txtX1.Text = "";
			// 
			// label25
			// 
			this.label25.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label25.Location = new System.Drawing.Point(40, 32);
			this.label25.Name = "label25";
			this.label25.Size = new System.Drawing.Size(16, 18);
			this.label25.TabIndex = 18;
			this.label25.Text = "=";
			// 
			// label26
			// 
			this.label26.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label26.Location = new System.Drawing.Point(8, 32);
			this.label26.Name = "label26";
			this.label26.Size = new System.Drawing.Size(24, 18);
			this.label26.TabIndex = 17;
			this.label26.Text = "x1";
			// 
			// label21
			// 
			this.label21.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label21.Location = new System.Drawing.Point(512, 32);
			this.label21.Name = "label21";
			this.label21.Size = new System.Drawing.Size(16, 18);
			this.label21.TabIndex = 16;
			this.label21.Text = "=";
			// 
			// label22
			// 
			this.label22.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label22.Location = new System.Drawing.Point(480, 32);
			this.label22.Name = "label22";
			this.label22.Size = new System.Drawing.Size(24, 18);
			this.label22.TabIndex = 14;
			this.label22.Text = "x3";
			// 
			// label23
			// 
			this.label23.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label23.Location = new System.Drawing.Point(240, 32);
			this.label23.Name = "label23";
			this.label23.Size = new System.Drawing.Size(16, 18);
			this.label23.TabIndex = 13;
			this.label23.Text = "=";
			// 
			// label24
			// 
			this.label24.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label24.Location = new System.Drawing.Point(208, 32);
			this.label24.Name = "label24";
			this.label24.Size = new System.Drawing.Size(24, 18);
			this.label24.TabIndex = 11;
			this.label24.Text = "x2";
			// 
			// groupBox2
			// 
			this.groupBox2.Controls.Add(this.label15);
			this.groupBox2.Controls.Add(this.label14);
			this.groupBox2.Controls.Add(this.label13);
			this.groupBox2.Controls.Add(this.label11);
			this.groupBox2.Controls.Add(this.txtB);
			this.groupBox2.Controls.Add(this.txtD);
			this.groupBox2.Controls.Add(this.txtC);
			this.groupBox2.Controls.Add(this.label19);
			this.groupBox2.Controls.Add(this.label18);
			this.groupBox2.Controls.Add(this.label8);
			this.groupBox2.Controls.Add(this.label16);
			this.groupBox2.Controls.Add(this.label17);
			this.groupBox2.Controls.Add(this.groupBox4);
			this.groupBox2.Controls.Add(this.label10);
			this.groupBox2.Controls.Add(this.label9);
			this.groupBox2.Controls.Add(this.label7);
			this.groupBox2.Controls.Add(this.label6);
			this.groupBox2.Controls.Add(this.label5);
			this.groupBox2.Controls.Add(this.label4);
			this.groupBox2.Controls.Add(this.label3);
			this.groupBox2.Controls.Add(this.label2);
			this.groupBox2.Controls.Add(this.label1);
			this.groupBox2.Controls.Add(this.txtA);
			this.groupBox2.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.groupBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.groupBox2.Location = new System.Drawing.Point(8, 112);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(736, 104);
			this.groupBox2.TabIndex = 13;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "Giải phương trình";
			// 
			// label15
			// 
			this.label15.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label15.Location = new System.Drawing.Point(512, 64);
			this.label15.Name = "label15";
			this.label15.Size = new System.Drawing.Size(16, 18);
			this.label15.TabIndex = 26;
			this.label15.Text = "5";
			// 
			// label14
			// 
			this.label14.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label14.Location = new System.Drawing.Point(424, 64);
			this.label14.Name = "label14";
			this.label14.Size = new System.Drawing.Size(16, 24);
			this.label14.TabIndex = 25;
			this.label14.Text = "+";
			// 
			// label13
			// 
			this.label13.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label13.Location = new System.Drawing.Point(280, 32);
			this.label13.Name = "label13";
			this.label13.Size = new System.Drawing.Size(16, 24);
			this.label13.TabIndex = 24;
			this.label13.Text = "+";
			// 
			// label11
			// 
			this.label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label11.Location = new System.Drawing.Point(240, 32);
			this.label11.Name = "label11";
			this.label11.Size = new System.Drawing.Size(24, 24);
			this.label11.TabIndex = 23;
			this.label11.Text = "x2";
			// 
			// txtB
			// 
			this.txtB.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.txtB.Location = new System.Drawing.Point(160, 32);
			this.txtB.Name = "txtB";
			this.txtB.Size = new System.Drawing.Size(72, 22);
			this.txtB.TabIndex = 22;
			this.txtB.Text = "";
			this.txtB.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// txtD
			// 
			this.txtD.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.txtD.Location = new System.Drawing.Point(456, 32);
			this.txtD.Name = "txtD";
			this.txtD.Size = new System.Drawing.Size(72, 22);
			this.txtD.TabIndex = 21;
			this.txtD.Text = "";
			this.txtD.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// txtC
			// 
			this.txtC.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.txtC.Location = new System.Drawing.Point(312, 32);
			this.txtC.Name = "txtC";
			this.txtC.Size = new System.Drawing.Size(72, 22);
			this.txtC.TabIndex = 20;
			this.txtC.Text = "";
			this.txtC.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// label19
			// 
			this.label19.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label19.Location = new System.Drawing.Point(360, 64);
			this.label19.Name = "label19";
			this.label19.Size = new System.Drawing.Size(48, 18);
			this.label19.TabIndex = 19;
			this.label19.Text = " -8    x";
			// 
			// label18
			// 
			this.label18.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label18.Location = new System.Drawing.Point(280, 64);
			this.label18.Name = "label18";
			this.label18.Size = new System.Drawing.Size(16, 24);
			this.label18.TabIndex = 18;
			this.label18.Text = "+";
			// 
			// label8
			// 
			this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label8.Location = new System.Drawing.Point(208, 64);
			this.label8.Name = "label8";
			this.label8.Size = new System.Drawing.Size(56, 18);
			this.label8.TabIndex = 17;
			this.label8.Text = "  -5   x2";
			// 
			// label16
			// 
			this.label16.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label16.Location = new System.Drawing.Point(424, 32);
			this.label16.Name = "label16";
			this.label16.Size = new System.Drawing.Size(16, 24);
			this.label16.TabIndex = 16;
			this.label16.Text = "+";
			// 
			// label17
			// 
			this.label17.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label17.Location = new System.Drawing.Point(392, 32);
			this.label17.Name = "label17";
			this.label17.Size = new System.Drawing.Size(16, 24);
			this.label17.TabIndex = 15;
			this.label17.Text = "x";
			// 
			// groupBox4
			// 
			this.groupBox4.Controls.Add(this.btnGiai);
			this.groupBox4.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.groupBox4.Location = new System.Drawing.Point(616, 24);
			this.groupBox4.Name = "groupBox4";
			this.groupBox4.Size = new System.Drawing.Size(112, 56);
			this.groupBox4.TabIndex = 13;
			this.groupBox4.TabStop = false;
			// 
			// btnGiai
			// 
			this.btnGiai.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.btnGiai.Location = new System.Drawing.Point(16, 16);
			this.btnGiai.Name = "btnGiai";
			this.btnGiai.Size = new System.Drawing.Size(80, 24);
			this.btnGiai.TabIndex = 0;
			this.btnGiai.Text = "Giải";
			this.btnGiai.Click += new System.EventHandler(this.btnGiai_Click);
			// 
			// label10
			// 
			this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label10.Location = new System.Drawing.Point(584, 64);
			this.label10.Name = "label10";
			this.label10.Size = new System.Drawing.Size(16, 18);
			this.label10.TabIndex = 12;
			this.label10.Text = "0";
			// 
			// label9
			// 
			this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label9.Location = new System.Drawing.Point(552, 64);
			this.label9.Name = "label9";
			this.label9.Size = new System.Drawing.Size(16, 18);
			this.label9.TabIndex = 11;
			this.label9.Text = "=";
			// 
			// label7
			// 
			this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label7.Location = new System.Drawing.Point(128, 64);
			this.label7.Name = "label7";
			this.label7.Size = new System.Drawing.Size(16, 24);
			this.label7.TabIndex = 9;
			this.label7.Text = "+";
			// 
			// label6
			// 
			this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label6.Location = new System.Drawing.Point(56, 64);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(56, 18);
			this.label6.TabIndex = 8;
			this.label6.Text = "   8   x3";
			// 
			// label5
			// 
			this.label5.AutoSize = true;
			this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label5.Location = new System.Drawing.Point(8, 64);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(41, 18);
			this.label5.TabIndex = 7;
			this.label5.Text = "Ví dụ:";
			// 
			// label4
			// 
			this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label4.Location = new System.Drawing.Point(584, 32);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(16, 24);
			this.label4.TabIndex = 5;
			this.label4.Text = "0";
			// 
			// label3
			// 
			this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label3.Location = new System.Drawing.Point(552, 32);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(16, 24);
			this.label3.TabIndex = 4;
			this.label3.Text = "=";
			// 
			// label2
			// 
			this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label2.Location = new System.Drawing.Point(128, 32);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(16, 24);
			this.label2.TabIndex = 2;
			this.label2.Text = "+";
			// 
			// label1
			// 
			this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label1.Location = new System.Drawing.Point(88, 32);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(24, 24);
			this.label1.TabIndex = 1;
			this.label1.Text = "x3";
			// 
			// txtA
			// 
			this.txtA.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.txtA.Location = new System.Drawing.Point(8, 32);
			this.txtA.Name = "txtA";
			this.txtA.Size = new System.Drawing.Size(72, 22);
			this.txtA.TabIndex = 0;
			this.txtA.Text = "";
			this.txtA.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.linkLabel1);
			this.groupBox1.Controls.Add(this.label20);
			this.groupBox1.Controls.Add(this.label12);
			this.groupBox1.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.groupBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.groupBox1.Location = new System.Drawing.Point(8, 8);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(736, 88);
			this.groupBox1.TabIndex = 14;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "Hướng dẫn";
			// 
			// linkLabel1
			// 
			this.linkLabel1.Location = new System.Drawing.Point(336, 56);
			this.linkLabel1.Name = "linkLabel1";
			this.linkLabel1.Size = new System.Drawing.Size(88, 24);
			this.linkLabel1.TabIndex = 2;
			this.linkLabel1.TabStop = true;
			this.linkLabel1.Text = "vào đây";
			this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
			// 
			// label20
			// 
			this.label20.Location = new System.Drawing.Point(8, 56);
			this.label20.Name = "label20";
			this.label20.Size = new System.Drawing.Size(328, 24);
			this.label20.TabIndex = 1;
			this.label20.Text = "Để xem thuật toán giải phương trình bậc 3 các bạn hãy   ";
			// 
			// label12
			// 
			this.label12.Location = new System.Drawing.Point(8, 32);
			this.label12.Name = "label12";
			this.label12.Size = new System.Drawing.Size(704, 24);
			this.label12.TabIndex = 0;
			this.label12.Text = "Các bạn hãy điền các giá trị a, b, c và d lần lượt vào 4 ô trống bên dưới. Các bạ" +
				"n hãy xem ví dụ để hiểu cách làm nhé! ";
			// 
			// GiaiPhuongTrinhBac3PhienBanMoi
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(754, 320);
			this.Controls.Add(this.groupBox3);
			this.Controls.Add(this.groupBox2);
			this.Controls.Add(this.groupBox1);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.MaximizeBox = false;
			this.Name = "GiaiPhuongTrinhBac3PhienBanMoi";
			this.Text = "Giai Phuong Trinh Bac 3 Phien Ban Moi";
			this.groupBox3.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.groupBox4.ResumeLayout(false);
			this.groupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion


		// Giải phương trình bậc 3
		private void btnGiai_Click(object sender, System.EventArgs e)
		{
			if (txtA.Text == "")
			{
				MessageBox.Show("Xin bạn vui lòng điền vào ô trống giá trị A!");
			}

			else if (txtB.Text == "")
			{
				MessageBox.Show("Xin bạn vui lòng điền vào ô trống giá trị B!");
			}

			else if (txtC.Text == "")
			{
				MessageBox.Show("Xin bạn vui lòng điền vào ô trống giá trị C!");
			}

			else if (txtD.Text == "")
			{
				MessageBox.Show("Xin bạn vui lòng điền vào ô trống giá trị D!");
			}

			else
			{
				try
				{
					double dblGiaTriA = Convert.ToDouble(txtA.Text);
					double dblGiaTriB = Convert.ToDouble(txtB.Text);
					double dblGiaTriC = Convert.ToDouble(txtC.Text);
					double dblGiaTriD = Convert.ToDouble(txtD.Text);
					double dblGiaTriX1 = 0;
					double dblGiaTriX2 = 0;
					double dblGiaTriX3 = 0;

					// Tìm biến số f
					// f = [(3c/a) - (b²/a²)] / 3
					double dblF = (((3*dblGiaTriC)/dblGiaTriA) - ((dblGiaTriB*dblGiaTriB)/(dblGiaTriA*dblGiaTriA))) / 3;

					// Tìm biến số g
					// g = [(2b³/a³) - (9bc/a²) + (27d/a)] / 27
					double dblG = (((2*dblGiaTriB*dblGiaTriB*dblGiaTriB)/(dblGiaTriA*dblGiaTriA*dblGiaTriA)) - ((9*dblGiaTriB*dblGiaTriC)/(dblGiaTriA*dblGiaTriA)) + ((27*dblGiaTriD)/dblGiaTriA)) / 27;

					// Tìm biến số h
					// h = (g²/4) + (f³/27)
					double dblH = ((dblG*dblG)/4) + ((dblF*dblF*dblF)/27);


					// Nếu h > 0, phương trình chỉ có duy nhất 1 nghiệm thực
					if (dblH > 0)
					{
						// Tìm giá trị R
						// R = -(g/2) + (h)½
						double dblHMu1Phan2 = Math.Sqrt(dblH);
						double dblR = -(dblG/2) + dblHMu1Phan2;

						// Vì không thể tính được Căn Bậc 3 của một số âm nên chúng ta sẽ sử dụng giá trị e
						double dblE = 1;
						if (dblR < 0)
						{
							dblE = -1;
						}
						else
						{
							dblE = 1;
						}
						double dblRMu1Phan3 = Math.Pow(dblR*dblE, 0.33333333333333333333333333333333);
						dblRMu1Phan3 = dblRMu1Phan3 * dblE;

						// Tìm giá trị S
						// S = (R)^(1/3)
						double dblS = dblRMu1Phan3;

						// Tìm giá trị T
						// T = -(g/2) - (h)½
						double dblT = -(dblG/2) - dblHMu1Phan2;
						if (dblT < 0)
						{
							dblE = -1;
						}
						else
						{
							dblE = 1;
						}
						double dblTMu1Phan3 = Math.Pow(dblT*dblE, 0.33333333333333333333333333333333);
						dblTMu1Phan3 = dblTMu1Phan3 * dblE;

						// Tìm giá trị U
						// U = (T)^(1/3)
						double dblU = dblTMu1Phan3;


						// Tính giá trị X1
						// X1 = (S + U) - (b/3a)
						dblGiaTriX1 = (dblS+dblU) - (dblGiaTriB/(3*dblGiaTriA));
 
						// Tính giá trị X2
						// X2 = -(S + U)/2 - (b/3a) + i*(S-U)*(3)½/2
						double dbl3Mu1Phan2 = Math.Pow(3,0.5);
						double dblVeTraiX2 = -(dblS+dblU)/2 - (dblGiaTriB/(3*dblGiaTriA));
						double dblVePhaiX2 = ((dblS-dblU)*dbl3Mu1Phan2)/2;  

						// Tính giá trị X3
						// X3 = -(S + U)/2 - (b/3a) - i*(S-U)*(3)½/2
						double dblVeTraiX3 = -(dblS+dblU)/2 - (dblGiaTriB/(3*dblGiaTriA));
						double dblVePhaiX3 = ((dblS-dblU)*dbl3Mu1Phan2)/2;  

				
						// Hiển thị giá trị X1
						txtX1.Text = dblGiaTriX1.ToString();

						// Hiển thị giá trị X2
						txtX2.Text = dblVeTraiX2.ToString() + " + i * " +  dblVePhaiX2.ToString();

						// Hiển thị giá trị X3
						txtX3.Text = dblVeTraiX3.ToString() + " - i * " +  dblVePhaiX3.ToString();
					}



						// Trong trường hợp đặc biệt khi mà f = 0, g = 0 và h = 0 thì tất cả 3 nghiệm là thực và bằng nhau
						// X1 = X2 = X3= (d/a)^(1/3) * (-1)
					else if (dblF == 0 && dblG == 0 && dblH == 0)
					{
						double dblS = 1;
						double dblDTrenAMu1Phan3 = 0;
						double dblDTrenA = dblGiaTriD / dblGiaTriA;
						dblDTrenAMu1Phan3 = Math.Pow(dblDTrenA, 0.33333333333333333333333333333333)*(-1);
						if (dblDTrenAMu1Phan3 < 0)
						{
							dblS = 1;
						}
						if (dblDTrenAMu1Phan3 > 0)
						{
							dblS = -1;
						}
						dblDTrenAMu1Phan3 = Math.Pow(dblDTrenA*dblS, 0.33333333333333333333333333333333)*(-1);
						dblDTrenAMu1Phan3 = dblDTrenAMu1Phan3 * dblS;


						// Tính giá trị X1
						dblGiaTriX1 = dblDTrenAMu1Phan3;

						// Tính giá trị X2
						dblGiaTriX2 = dblDTrenAMu1Phan3;

						// Tính giá trị X3
						dblGiaTriX3 = dblDTrenAMu1Phan3;

						// Hiển thị giá trị X1
						txtX1.Text = dblGiaTriX1.ToString();

						// Hiển thị giá trị X2
						txtX2.Text = dblGiaTriX2.ToString();

						// Hiển thị giá trị X3
						txtX3.Text = dblGiaTriX3.ToString();
					}




						// Khi h <= 0, thì tất cả 3 nghiệm là thực
					else if (dblH <= 0)
					{
						// Tìm biến số i
						// i = ((g²/4) - h) ½ 
						double dblS = 1;
						double dblBieuThuc = (dblG*dblG)/4 - dblH;
						double dblI = Math.Pow(dblBieuThuc, 0.5);
						if (dblI < 0)
						{
							dblS = -1;
						}
						if (dblI > 0)
						{
							dblS = 1;
						}
						dblI = Math.Pow(dblBieuThuc*dblS,0.5);
						dblI = dblI * dblS;



						// Tìm biến số j
						// j = (i)^(1/3)
						double dblJ = Math.Pow(dblI, 0.33333333333333333333333333333333);
						if (dblJ < 0)
						{
							dblS = -1;
						}
						if (dblJ > 0)
						{
							dblS = 1;
						}
						dblJ = Math.Pow(dblI*dblS, 0.33333333333333333333333333333333);
						dblJ = dblJ * dblS;

						// Tìm biến số k
						// k = arc cosine (- (g / 2i)) 
						double dblGTren2i = -(dblG/(2*dblI));
						double dblK = Math.Acos(dblGTren2i);

						// Tìm giá trị của L
						// L = j * (-1)
						double dblL = dblJ * (-1);

						// Tìm giá trị của M
						// M = cosine (K/3)
						double dblKTren3 = dblK / 3;
						double dblM = Math.Cos(dblKTren3);
						

						// Tìm giá trị của N
						// N = (Căn bậc 2 của 3) * sine (K/3)
						double dblCanBac2Cua3 = Math.Sqrt(3);
						double dblSinCuaKTren3 = Math.Sin(dblKTren3);
						double dblN = dblCanBac2Cua3 * dblSinCuaKTren3;
						

						// Tìm giá trị của P
						// P = (b/3a) * (-1)
						double dblP = (dblGiaTriB/(3*dblGiaTriA)) * (-1);

						// Tính giá trị X1
						// X1 = 2j * cosine(k/3) - (b/3a)
						double dblCosinCuaKTren3 = Math.Cos(dblKTren3);
						double dblX1 = 2*dblJ*dblCosinCuaKTren3 - (dblGiaTriB/(3*dblGiaTriA));
						dblGiaTriX1 = dblX1;

						// Tính giá trị X2
						// X2 = L * (M + N) + P
						dblGiaTriX2 = (dblL * (dblM + dblN)) + dblP;

						// Tính giá trị X3
						// X3 = L * (M - N) + P
						dblGiaTriX3 = (dblL * (dblM - dblN)) + dblP;


						// Hiển thị giá trị X1
						txtX1.Text = dblGiaTriX1.ToString();
				
						// Hiển thị giá trị X2
						txtX2.Text = dblGiaTriX2.ToString();

						// Hiển thị giá trị X3
						txtX3.Text = dblGiaTriX3.ToString();
					}
				}
				catch (Exception ex)
				{
					MessageBox.Show("Đã có lỗi xảy ra! Bạn hãy kiểm tra lại xem mình đã thao tác đúng chưa nhé!", ex.Source);
				}
			}
		}


		// Link đến trang chứa Thuật toán giải phương trình bậc 3
		private void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
		{
			Process.Start("http://www.1728.com/cubic2.htm");
		}
	}
}
